<link type="text/css" rel="stylesheet" href="{url:#css/ucenter.css}" />
<div class="container clearfix">
    {widget:name=sub_navs action=ucsidebar sidebar=$sidebar act=$actionId}
    <div class="content clearfix uc-content">
        <h1 class="title"><span>我的消息：</span></h1>
        <div class="tab">
            <ul class="tab-head">
                <li>未读消息<i></i></li>
                <li>已读消息<i></i></li>
            </ul>
            <div class="tab-body"  style="padding: 20px 10px;">
                <div id="message-n" class="js-template">
                    <div class="page-content">
                        <div class="box mt10">
                            <h2><span>{title}</span> <span class="fr">{time}</span></h2>
                            <div class="p10">
                                {content}
                                <p class="tr"><a href="javascript:;" class="btn btn-main btn-mini" onclick="message_read('{id}')">标记已阅读</a></p>
                            </div>
                        </div>
                    </div>
                    <div class="page-nav"></div>
                </div>
                <div id="message-y" class="js-template">
                  <div class="page-content">
                     <div class="box mt10">
                        <h2><span>{title}</span> <span class="fr">{time}</span></h2>
                        <div class="p10">
                           {content}
                           <p class="tr"><a href="javascript:;" class="btn btn-default btn-mini" onclick="message_del('{id}')">删除</a></p>
                       </div>
                   </div>
               </div>
               <div class="page-nav"></div>
           </div>
       </div>
   </div>
</div>
</div>
<script type="text/javascript">
 function message_n(){
  $("#message-n").Paging({
    url:'{url:/ucenter/get_message}',
    params:{status:'n'}
});
}
function message_y(){
    $("#message-y").Paging({
        url:'{url:/ucenter/get_message}',
        params:{status:'y'}
    });
}
message_n();
message_y();
function message_read(id){
 $.post("{url:/ucenter/message_read}",{id:id},function(data){
  if(data['status']=='success'){
   message_n();
   message_y();
}
},'json')
}
function message_del(id){
 $.post("{url:/ucenter/message_del}",{id:id},function(data){
  if(data['status']=='success'){
    message_y();
}
},'json')
}
</script>
